﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>salary_standardTh</title>
    <script src="~/lib/axios/dist/axios.js"></script>
    <script src="~/lib/vue/dist/vue.js"></script>
    <script src="~/lib/element-ui/lib/index.js"></script>
    <link href="~/lib/element-ui/lib/theme-chalk/index.css" rel="stylesheet" />
</head>
<body>
    <div id="app">
        <el-container>
            <el-header>
                <el-card class="box-card" style="height: 65px">
                    <el-form ref="form" :model="form" :rules="rules" label-width="80px" :inline="true" size="mini">
                        <el-form-item label="请输入薪酬标准编号" prop="ssd_id" label-width="149px">
                            <template>
                                <el-select v-model="form.ssd_id" placeholder="请选择薪酬标准编号" style="width: 175px; ">
                                    <el-option v-for="item in listm"
                                               :key="item.ssd_id"
                                               :label="item.standard_id"
                                               :value="item.ssd_id">
                                    </el-option>
                                </el-select>
                            </template>
                        </el-form-item>
                        <el-form-item label="请输入关键字" prop="standard_name" label-width="135px">
                            <el-input v-model="form.standard_name" style="width: 130px;"></el-input>
                        </el-form-item>
                        <el-form-item prop="time" label="请输入建档时间" label-width="130px">
                            <el-date-picker v-model="form.time"
                                            type="daterange"
                                            style="width: 300px; margin-right: 27px; "
                                            range-separator="至"
                                            format="yyyy 年 MM 月 dd 日"
                                            value-format="yyyy-MM-dd"
                                            start-placeholder="开始日期"
                                            end-placeholder="结束日期">
                            </el-date-picker>
                        </el-form-item>
                        <el-form-item>
                            <template>
                                <el-button type="primary" @@click="submitForm('form')" style="width: 50px;">查询</el-button>
                            </template>
                        </el-form-item>
                    </el-form>
                </el-card>
            </el-header>
            <el-main>
                <el-card class="box-card">
                    <el-table :data="list" style="width: 100%" border stripe>
                        <el-table-column prop="standard_id"
                                         label="薪酬标准编号"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="standard_name"
                                         label="薪酬标准名称"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="designer"
                                         label="制定人"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="regist_time"
                                         label="登记时间"
                                         align="center"
                                         :formatter="dateFormat">
                        </el-table-column>
                        <el-table-column prop="salary_sum"
                                         label="薪酬总额"
                                         align="center">
                        </el-table-column>
                        <el-table-column label="操作" align="center">
                            <template slot-scope="scope">
                                <el-button size="mini" type="primary" @@click="cz(scope.row)">变更</el-button>
                            </template>
                        </el-table-column>
                    </el-table>

                    <el-row>
                        <el-col :span="1">
                            <el-pagination v-on:size-change="handleSizeChange"
                                           v-on:current-change="handleCurrentChange"
                                           :current-page="queryinfo.currentPage"
                                           :page-sizes="[1, 2, 3, 4]"
                                           :page-size="queryinfo.pageSize"
                                           layout="total, sizes, prev, pager, next, jumper"
                                           :total="total">
                            </el-pagination>
                        </el-col>
                    </el-row>
                </el-card>
            </el-main>
        </el-container>
    </div>
    <script type="text/javascript">
    var vm = new Vue({
        el: "#app",
        data: {
            list: [],//薪酬
            listm:[],//用户
            queryinfo: {
                currentPage: 1,//当前页
                pageSize: 3//总页数
            },
            total: 1,//总条数
            form: {
                standard_name: '',
                time: '',
                ssd_id: '',
            },
            rules: {
                standard_name: [
                    { required: true, message: '请输入关键字', trigger: 'blur' }
                ],
                ssd_id: [
                    { required: true, message: '请选择薪酬标准编号', trigger: 'change' }
                ],
            }
            },
        methods: {
            //日期格式化
            dateFormat(row, column) {
                // 获取单元格数据
                let data = row[column.property]
                if (data == null) {
                    return null
                }
                let dt = new Date(data)
                return dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate();
            },
            submitForm(formName) {
                //表单提交
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        //薪酬模糊查询
                        axios.get('/salary_standardSe/QuerSeo', {
                            params: {
                                ssd_id: this.form.ssd_id,
                                standard_name: this.form.standard_name,
                                regist_time: this.form.time[0],
                                check_time: this.form.time[1],
                                currentPage: this.queryinfo.currentPage,
                                pageSize: this.queryinfo.pageSize
                            }
                        })
                            .then(res => {
                                console.info(res);
                                this.list = res.data.Data;
                                this.total = res.data.Row;
                            })
                            .catch(err => {
                                console.info(err);
                            });
                    } else {
                        this.$message({
                            type: 'error',
                            message: '请填写完整信息!'
                        });
                        return false;
                    }
                });
            },
                cz(row) {
                    location.href = "/salary_standardTh/salary_standardThUpdate/" + row.ssd_id;
                },
            fill() {
                   //薪酬为通过查询
                    axios.get('/salary_standardSe/Querse', {
                        params: {
                            currentPage: this.queryinfo.currentPage,
                            pageSize: this.queryinfo.pageSize
                        }
                    })
                        .then(res => {
                            console.info(res);
                            this.list = res.data.Data;
                            this.total = res.data.Row;
                        })
                        .catch(err => {
                            console.info(err);
                        });
                        //薪酬基本信息查询
                axios.get('/salary_standardSe/Ate')
                    .then(res => {
                        console.info(res);
                        this.listm = res.data;
                    })
                    .catch(err => {
                        console.info(err);
                    });
            },
            //分页总页数改变事件
                handleSizeChange(val) {
                    this.queryinfo.pageSize = val;
                    this.fill();
            },
                //分页当前页改变事件
                handleCurrentChange(val) {
                    this.queryinfo.currentPage = val;
                    this.fill();
                }
        },
         //可以对vue的数据和方法进行操作,不能对DOM进行操作
            created: function () {
                this.fill();
            }
        });
    </script>
    <style scoped>
        element.style {
            height: 100%;
            width: 1239px;
        }

        .el-button.is-circle {
            border-radius: 50%;
            padding: 12px;
            position: relative;
            top: -10px;
            right: -570px;
        }
    </style>
</body>
</html>
